﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XYW.WebSite;

namespace xyw
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            if (!RuntimeCache.Contains<DataTable>("News1") || !RuntimeCache.Contains<DataTable>("News0"))
            {
                XYW.BLL.News_Classify bllNewsClassify = new XYW.BLL.News_Classify();

                DataTable dt0 = bllNewsClassify.GetList("type=0").Tables[0];
                DataTable dt1 = bllNewsClassify.GetList("type=1").Tables[0];

                this.RepeaterNews0.DataSource = dt0;
                this.RepeaterNews0.DataBind();
                this.RepeaterNews1.DataSource = dt1;
                this.RepeaterNews1.DataBind();
            }
            else
            {
                this.RepeaterNews0.DataSource = RuntimeCache.Get<DataTable>("New0");
                this.RepeaterNews0.DataBind();
                this.RepeaterNews1.DataSource = RuntimeCache.Get<DataTable>("New1");
                this.RepeaterNews1.DataBind();
            }
        }
    }
}